import getConfig from "next/config";

export async function HttpClient(url: string, options: RequestInit) {
  const { httpOptions } = getConfig();
  const { path = "localhost", port = 3000 } = httpOptions || {};
  return await (
    await fetch(`http://${path}:${port}${url}`, {
      headers: {
        Accept: "application/vnd.dpexpo.v1+json", //设置请求头
      },
      ...options,
    })
  ).json();
}
